package com.whp.openapi.web.controller;

import com.whp.openapi.common.ResponseResult;
import com.whp.openapi.common.ResultTable;
import com.whp.openapi.entity.AppInfo;
import com.whp.openapi.service.AppInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author whp
 * @date 2021/11/26
 */
@RestController
@RequestMapping("/app_info")
public class AppInfoController {
    
    @Autowired
    private AppInfoService appInfoService;

    /**
     * 应用管理：搜索、分页
     * @param page
     * @param limit
     * @param corpName
     * @return
     */
    @RequestMapping("/table")
    public ResultTable table(@RequestParam(defaultValue = "1") Integer page,
                             @RequestParam(defaultValue = "10") Integer limit,
                             String corpName){
        return appInfoService.table(page, limit, corpName);
    }

    /**
     * 删除
     * @param ids
     * @return
     */
    @RequestMapping("/del")
    public ResponseResult delAppInfo(Integer[] ids) {
        return appInfoService.delAppInfo(ids);
    }

    /**
     * 添加
     * @param appInfo
     * @return
     */
    @RequestMapping("/add")
    public ResponseResult addAppInfo(AppInfo appInfo) {
        return appInfoService.addAppInfo(appInfo);
    }

    /**
     * 编辑
     * @param appInfo
     * @return
     */
    @RequestMapping("/update")
    public ResponseResult updateAppInfo(AppInfo appInfo) {
        return appInfoService.updateAppInfo(appInfo);
    }
}
